#ifndef _PANEL_CONTEXT_H
#define _PANEL_CONTEXT_H

#include <qinputcontext.h>
#include <qtimer.h>
class CKey;

#include <QProxyStyle>
class CProxyStyle : public QProxyStyle
{
public:
    int styleHint(StyleHint hint,
                  const QStyleOption *option,
                  const QWidget *widget,
                  QStyleHintReturn *returnData) const;
};

class CKeyBoard : public QInputContext {
    Q_OBJECT

public:
    CKeyBoard(QObject *parent = NULL);
    ~CKeyBoard();
    static void showKeyboard();
    static void hideKeyboard();

protected:
    bool filterEvent(const QEvent* event);
    QString identifierName();
    QString language();
    void reset();
    bool isComposing() const;

private:
signals:
    void txPopupKeyboard(bool bPopup);

private slots:
    void sendCharacter(QChar character);
    void timeout();

private:
    void updatePosition();
    void startMyTimer(bool bShow);

private:
    CKey *pKey;
    QTimer timer;
    bool bShow;
    QPoint panelStartPos;
    int increment;
};

#endif
